Optical encoding is widely used in electronic input devices such as mice and trackballs. Standard optical encoding techniques employ a rotatable encoding wheel having light-blocking regions alternating circumferentially with light-transmitting regions at an edge portion of the wheel. The encoding wheel is mounted with its edge portion positioned between a light source, typically a light emitting diode (LED), and a light sensor, typically a phototransistor (PTR). As the encoding wheel rotates, the amount of light reaching the light sensor from the light source varies periodically, producing a corresponding periodically-varying electrical signal from the light sensor.
Typically, two light sensors along with one or two light sources are employed with each encoding wheel. The light sensors are positioned, relative to the wheel and light sources, such that the periodic output of one of the light sensors is about 90.degree. out of phase with the periodic output of the other of the light sensors (i.e., the periodic outputs of the two sensors are in quadrature). The two outputs are individually converted to one-bit binary digital signals by some form of single-bit analog-to-digital conversion. Together, the two converted outputs provide a four-state position indication, as illustrated in FIG. 1 (prior art), so that both displacement and direction of the encoding wheel may be sensed.
FIG. 1 shows a exemplary trace of the outputs 1 and 2 of two light sensors, as a function of the rotational position of an associated encoding wheel. When the outputs 1 and 2 are converted to discrete binary values at an optimal digitization threshold O, four output states result. The regions labeled I-IV represent the rotational position corresponding to each of the four output states. Region I corresponds to the 1,1 state, (i.e., the state in which the converted outputs 1, 2, converted to single-bit binary, yield the values 1, 1, respectively). Similarly, region II corresponds to the 1,0 state, region III to the 0,0 state, and region IV to the 0,1 state.
Variability in the brightness of light sources and in the sensitivity of light sensors causes difficulties in the design and manufacture of optical encoders. High-volume, low-cost LEDs and PTRs exhibit a wide range of variability in performance characteristics. The ability of an optical encoder in an input device to tolerate variation in the LED/PTR pairs thus directly impacts the cost and manufacturing viability of the input device.
To reduce the effects of the wide range of inherent variation in LED and PTR performance, LEDs and PTRs are typically sorted into bins according to their brightness or sensitivity. This "binning" allows designers to specify brighter LEDs for pairing with less sensitive PTRs, thus reducing the total range of variation that would result from random pairing.
Typical optical encoder designs have some degree of adaptability, i.e., the sensitivity level or "gain" of the encoding circuits is adjustable within a certain range, so that a certain range of LED/PTR pairs may be used. Adjusting the sensitivity level of the encoding circuits has the effect of adjusting the amplitude and position of the output curves 1, 2 shown in FIG. 1 relative to the digitization threshold for conversion to binary. The digitization threshold is desirably set at the optimal level O shown in FIG. 1. Any other position changes the relative sizes of the regions I-IV corresponding to the areas of the four output states.
The range of LED/PTR pairs usable with a typical optical encoder design is specified such that the encoder has at least some ability to encode at startup i.e., the digitization threshold at startup of the device must be within (typically well within) the boundaries B shown in FIG. 1, so that motion may be encoded at least to some degree. The sensitivity of the encoding circuits is then adjusted, while motion is being encoded, to optimal levels, bringing the digitization threshold for conversion to digital output close to the optimal digitization threshold O. Even with some adaptability and the use of matched LED/PTR pairs, the total variation in the response of the LED/PTR pairs is great enough that only a relatively few of the possible bin combinations are usable in a typical optical encoder design, resulting in many unusable LEDs and PTRs in a standard high-volume production lot.
In order to utilize more of the total production of LEDs and PTRs, an optical encoder design with greater than standard adaptability can be used, but an apparatus and method is then required to properly set the sensitivity level of the encoding circuits to match the LED/PTR pairs employed. The apparatus and method must be able to locate the proper sensitivity level even though the encoder may not function to encode motion at all until after the sensitivity approaches the proper level. To support such applications as plug-and-play mice and trackballs, the apparatus and method should also be able to determine the proper sensitivity level even when the encoding wheel is in already in motion upon power-up.
The present invention achieves these and other advantages by use of a sensitivity threshold locator that detects the sensitivity threshold (maximum and/or minimum) at which a particular prescribed digital output state (or states) of the light detector output(s) occurs. The correct sensitivity level for motion encoding is then chosen as a function of the detected threshold(s). The sensitivity threshold locator may be implemented wholly in hardware or in a mixture of hardware and software or firmware. The sensitivity threshold locator detects a sensitivity threshold by sampling the digitally converted outputs of the light detectors to check for a prescribed output state, while varying the sensitivity level of the encoding circuits. The sensitivity level is set to one extreme of the sensitivity level range, after which the sensitivity threshold locator repeatedly checks for the existence of the prescribed digital output state. A state which is most probable at the one extreme is chosen as the prescribed state. Each time the prescribed state is detected, the sensitivity level is incremented (or decremented) away from the extreme, to a new sensitivity level at which the prescribed state is less (or, at most, equally) likely to occur. Thus the sensitivity level used by the sensitivity threshold locator will approach the limit at which the prescribed output state will not occur. The sensitivity threshold locator thus effectively detects the sensitivity threshold of the prescribed output state.
The prescribed output state may be the 1,1 state of a quadrature-related pair of light detectors, and the sensitivity level for each pair may be adjusted in unison. Alternatively, the prescribed output state may be the 1 (or 0) state of the binary-converted output of a single light detector, and the sensitivity level for each light detector may be adjusted together or individually, as desired. Other appropriate prescribed output states may be chosen, for example, the (0,0) state, the non-(0,0) state, or the non-(1,1) state, of a quadrature-related pair.
The correct sensitivity level for optical encoding (i.e., for motion encoding) is determined as a function of the sensitivity threshold(s) detected by the sensitivity threshold locator. The optimal motion encoding sensitivity level may be determined as linear function of the detected sensitivity threshold, and may be set by a processor operation, by a look-up table, or by other suitable means.
Sampling for locating the sensitivity threshold(s) of the prescribed output state(s) may be interleaved with sampling for motion encoding. Each new sensitivity level used for threshold location is also used to set a new sensitivity level for motion encoding. The total (absolute) motion detected during the threshold location process may be used to determine the end of the threshold location process. When no new threshold is located through a prescribed amount of total absolute motion, the threshold location process terminates, the sensitivity level is fixed at the proper level for motion encoding, and all further samples from the light detectors are used for motion encoding, with the resulting encoded motion being reported out as motion by the input device. (Motion encoded during threshold location is optionally not reported out as motion by the input device, since only half the sampling rate of the sampling circuit is used to encode such motion, increasing the possibly of aliasing.)
Using the total encoded motion of the encoding wheel to terminate the threshold location process, upon reaching a properly chosen prescribed amount of absolute total motion, statistically guarantees that the threshold location process will terminate within an acceptably short amount of motion, and at a sensitivity level adequately close to the actual sensitivity threshold.
The interleaving, during threshold location, of the sampling for threshold location with the sampling for motion encoding increases the possibility of aliasing in motion encoding. Also, motion of the encoder wheel during threshold location may be confined to small displacements, oscillatory in nature, depending upon the motion of the wheel caused by a user. To allow proper termination of threshold location under these circumstances, the total absolute motion is summed during threshold location, so that termination of threshold location will occur only after sufficient absolute motion to guarantee statistically that adequate sampling to find the threshold(s) has occurred. To prevent premature termination of threshold location due to possible jittering between adjacent states, the total motion is not incremented (or is decremented) upon a detected incremental position change indicating a change of direction.
Additional features and advantages of the invention will be made apparent from the following detailed description of an illustrated embodiment which proceeds with reference to the accompanying drawings.